package com.lian.servlet;

import com.lian.service.impl.workserviceimpl;
import com.lian.service.workservice;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Created by lenovo on 2018/8/8.
 */
public class delServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        request.setCharacterEncoding("utf-8");
        int workid=Integer.parseInt(request.getParameter("workid"));
        workservice ser=new workserviceimpl();
        int i=ser.delwork(workid);
          if(i>0){
            out.print(i);
//              out.print("<script language='javascript'>" +
//                      "var index = parent.layer.getFrameIndex(window.name);\n" +
//                      "  window.parent.location.reload();\n"+
//                      "  parent.layer.close(index);\n"+
//                      "</script>");
         }

        out.flush();
        out.close();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
